<%--
  Created by IntelliJ IDEA.
  User: dell
  Date: 2024/10/25
  Time: 22:01
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="java.nio.charset.StandardCharsets" %>
<%@ page import="static java.time.temporal.WeekFields.ISO" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<html>
<head>

    <base href="<%=basePath%>">
    <title>三</title>
</head>
<body>
<%@include file="top.html"%>
<%
    String namesex = (String) session.getValue("namesex");
    String hobby[] = new String[5];
    for(int i = 0;i<hobby.length;i++){
        String param = "hobby"+i;
        String getparam= request.getParameter(param);
        if(getparam!= null){
            hobby[i] = new String(getparam.getBytes("ISO-8859-1"),"UTF-8");
            synchronized(application){
                 Integer count = (Integer) application.getAttribute(param);
                 if(count == null)
                     count=new Integer(0);
        count = new Integer(count.intValue()+1);
        application.setAttribute(param,count);
        }
    }

    }
%>
<p>
    <%=(String) session.getValue("namesex")%>
    ,你感兴趣的爱好有：</p>
    <%
        for(int i = 0;i<hobby.length;i++)
            if(hobby[i]!= null){
                out.print("<p>");
                out.println(hobby[i]);
                out.println("</p>");
            }
            String hobbyname[]= {"影视观赏","阅读书籍","体育运动","户外旅游","流行音乐"};
            for(int i=0;i<hobby.length;i++){
                Integer count = (Integer)application.getAttribute("hobby"+i);
            if(count == null)
                count=new Integer(0);
            out.println("<p>选择"+hobbyname[i]+"的人数次为"+count+"</p>");

        }
    %>

</body>
</html>
